part of 'component.dart';

class SeparatorColumn extends Column {
  SeparatorColumn({
    super.key,
    super.mainAxisAlignment,
    super.mainAxisSize,
    super.crossAxisAlignment,
    super.textDirection,
    super.verticalDirection,
    super.textBaseline,
    required List<Widget> children,
    required this.separatorBuilder,
  }) : super(
            children: List.generate(
                children.length > 1 ? children.length * 2 - 1 : children.length,
                (i) {
          if (i.isOdd) {
            return separatorBuilder((i + 1) ~/ 2);
          }
          return children[(i.isOdd ? (i + 1) / 2 : i / 2).toInt()];
        }));
  final Widget Function(int index) separatorBuilder;
}

class SeparatorRow extends Row {
  SeparatorRow({
    super.key,
    super.mainAxisAlignment,
    super.mainAxisSize,
    super.crossAxisAlignment,
    super.textDirection,
    super.verticalDirection,
    super.textBaseline,
    required List<Widget> children,
    required this.separatorBuilder,
  }) : super(
            children: List.generate(
                children.length > 1 ? children.length * 2 - 1 : children.length,
                (i) {
          if (i.isOdd) {
            return separatorBuilder((i + 1) ~/ 2);
          }
          return children[(i.isOdd ? (i + 1) / 2 : i / 2).toInt()];
        }));
  final Widget Function(int index) separatorBuilder;
}
